package subject

import (
	"vrcm/src/vrcm/common/models"
)

type AnswerRecord struct {
	models.Model

	TenantId  string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	EventId   string `json:"event_id" gorm:"type:varchar(35);comment:活动id"`
	Account   string `json:"account" gorm:"type:varchar(50);comment:嘉宾账户"`
	Type      int    `json:"type" gorm:"type:tinyint;comment:类型 1.题目 2.投票 3.题词 4.点赞 5.问卷"`
	SubjectId int    `json:"subject_id" gorm:"type:bigint unsigned;comment:题目id"`
	PaperId   int    `json:"paper_id" gorm:"type:int;comment:试卷id"`
	Answer    string `json:"answer" gorm:"type:varchar(200);comment:答案"`
	IsRight   int    `json:"is_right" gorm:"type:tinyint(1);comment:是否正确 1正确 2错误 3弃权"`
	IsDelete  int    `json:"is_delete" gorm:"type:tinyint;comment:是否删除 1删除 2未删除"`
	models.ModelTime
	models.ControlBy
}

type AnswerRecordModel struct {
	models.Model

	TenantId    string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	EventId     string `json:"event_id" gorm:"type:varchar(35);comment:活动id"`
	Account     string `json:"account" gorm:"type:varchar(50);comment:嘉宾账户"`
	SubjectId   int    `json:"subject_id" gorm:"type:bigint unsigned;comment:题目id"`
	SubjectName string `json:"subject_name" gorm:"type:varchar(100);comment:题目名称"`
	PaperId     int    `json:"paper_id" gorm:"type:int;comment:试卷id"`
	PaperName   string `json:"paper_name" gorm:"type:varchar(50);comment:试卷名称"`
	Answer      string `json:"answer" gorm:"type:varchar(50);comment:答案"`
	IsRight     int    `json:"is_right" gorm:"type:tinyint(1);comment:是否正确 1正确 2错误 3弃权"`
	Key         string `json:"select_key"`
	CorrectNum  int    `json:"correct_num" comment:"正确数"`
	TotalNum    int    `json:"total_num" comment:"总数"`
	OptionNum   int    `json:"option_num" comment:"选项个数"`
	models.ModelTime
	models.ControlBy
}

type PerSubjectStatistics struct {
	SubjectId int    `json:"subject_id" comment:"题目id"`
	Account   string `json:"account" gorm:"type:varchar(50);comment:嘉宾账户"`
	IsRight   int    `json:"is_right" gorm:"type:tinyint(1);comment:是否正确 1正确 2错误 3弃权"`
	Answer    string `json:"answer" gorm:"type:varchar(50);comment:答案"`
	OptionNum int64  `json:"option_num" comment:"答案"`
}

type VoteStatistics struct {
	TenantId  string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	EventId   string `json:"event_id" gorm:"type:varchar(35);comment:活动id"`
	PaperId   int    `json:"paper_id" gorm:"type:int;comment:试卷id"`
	PaperName string `json:"paper_name" gorm:"type:varchar(50);comment:试卷名称"`
	VoteNum   int64  `json:"vote_num" comment:"投票人数"`
}
type VoteStatisticsDetail struct {
	TenantId    string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	EventId     string `json:"event_id" gorm:"type:varchar(35);comment:活动id"`
	PaperId     int    `json:"paper_id" gorm:"type:int;comment:试卷id"`
	PaperName   string `json:"paper_name" gorm:"type:varchar(50);comment:试卷名称"`
	SubjectId   int    `json:"subject_id" gorm:"type:bigint unsigned;comment:题目id"`
	SubjectName string `json:"subject_name" gorm:"type:varchar(100);comment:题目名称"`
	Account     string `json:"account" gorm:"type:varchar(50);comment:嘉宾账户"`
	Answer      string `json:"answer" gorm:"type:varchar(50);comment:答案"`
	OptionNum   int    `json:"option_num" comment:"答案"`
	models.ModelTime
}

type QuestionStatistics struct {
	TenantId  string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	EventId   string `json:"event_id" gorm:"type:varchar(35);comment:活动id"`
	PaperId   int    `json:"paper_id" gorm:"type:int;comment:试卷id"`
	PaperName string `json:"paper_name" gorm:"type:varchar(50);comment:试卷名称"`
	JoinNum   int64  `json:"join_num" comment:"参与人数"`
}

type QuestionStatisticsDetail struct {
	TenantId    string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	EventId     string `json:"event_id" gorm:"type:varchar(35);comment:活动id"`
	PaperId     int    `json:"paper_id" gorm:"type:int;comment:试卷id"`
	PaperName   string `json:"paper_name" gorm:"type:varchar(50);comment:试卷名称"`
	SubjectId   int    `json:"subject_id" gorm:"type:bigint unsigned;comment:题目id"`
	SubjectName string `json:"subject_name" gorm:"type:varchar(100);comment:题目名称"`
	Account     string `json:"account" gorm:"type:varchar(50);comment:嘉宾账户"`
	Answer      string `json:"answer" gorm:"type:varchar(50);comment:答案"`
	OptionNum   int    `json:"option_num" comment:"答案"`
	models.ModelTime
}

type SignInStatistics struct {
	TenantId  string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	EventId   string `json:"event_id" gorm:"type:varchar(35);comment:活动id"`
	PaperId   int    `json:"paper_id" gorm:"type:int;comment:试卷id"`
	PaperName string `json:"paper_name" gorm:"type:varchar(50);comment:试卷名称"`
	SignNum   int    `json:"sign_num" comment:"签到人数"`
	TotalNum  int    `json:"total_num" comment:"总数"`
}

type SignInStatisticsDetail struct {
	TenantId    string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	EventId     string `json:"event_id" gorm:"type:varchar(35);comment:活动id"`
	PaperId     int    `json:"paper_id" gorm:"type:int;comment:试卷id"`
	PaperName   string `json:"paper_name" gorm:"type:varchar(50);comment:试卷名称"`
	SubjectId   int    `json:"subject_id" gorm:"type:bigint unsigned;comment:题目id"`
	SubjectName string `json:"subject_name" gorm:"type:varchar(100);comment:题目名称"`
	Account     string `json:"account" gorm:"type:varchar(50);comment:嘉宾账户"`
	models.ModelTime
}

type LikesStatisticsDetail struct {
	TenantId  string `json:"tenant_id" gorm:"type:varchar(35);comment:租户id"`
	EventId   string `json:"event_id" gorm:"type:varchar(35);comment:活动id"`
	PaperId   int    `json:"paper_id" gorm:"type:int;comment:试卷id"`
	PaperName string `json:"paper_name" gorm:"type:varchar(50);comment:试卷名称"`
	SubjectId int    `json:"subject_id" gorm:"type:bigint unsigned;comment:题目id"`
	LiveName  string `json:"live_name" gorm:"type:varchar(100);comment:直播名称"`
	LikeNum   int    `json:"like_num" comment:"点赞人数"`
	LiveTime  int    `json:"live_time" comment:"直播时间"`
}

type LikesStatistics struct {
	Value int `json:"value" comment:"点赞数"`
}

func (AnswerRecord) TableName() string {
	return "answer_record"
}

func (e *AnswerRecord) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *AnswerRecord) GetId() interface{} {
	return e.Id
}
